import React, { useState, useEffect } from 'react'
export default function Brief() {
    let [oldTime, setOldTime] = useState("")
    let [newTime, setNewTime] = useState("")
    let [result, setResult] = useState("")
    let [day, setDay] = useState("")
    let [hous, setHous] = useState("")
    let [mis, setMis] = useState("")
    let [s, setS] = useState("")
    function getTime() {
        let oldTime: any = new Date().getTime()
        let newTime: any = new Date(2022, 5, 30).getTime()
        let result: any = (newTime - oldTime) / 1000
        let day: any = Math.floor(result / (60 * 60 * 24))
        let hous: any = Math.floor(result / (60 * 60) / 24)
        let mis: any = Math.floor(result / 60 % 60)
        let s: any = Math.floor(result % 60)
        s = s < 10 ? "0" + s : s
        mis = mis < 10 ? "0" + mis : mis
        hous = hous < 10 ? "0" + hous : hous
        day = day < 10 ? "0" + day : day
        setOldTime(oldTime)
        setNewTime(newTime)
        setResult(result)
        setDay(day)
        setHous(hous)
        setMis(mis)
        setS(s)
    }
    useEffect(() => {
        setInterval(getTime, 1000)
    }, [])
    return (
        <div>
            <div style={{
                textAlign: "center"
            }}>
                <h1 style={{
                    color: "orange"
                }}>讲师简介</h1>
                <h3 style={{
                    color: "#ddd"
                }}>COMPANY PROFILE</h3>
                <p style={{
                    color: "#ccc",
                    textIndent: "2em"
                }}>测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试
                    测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试
                </p>
                <p style={{
                    color: "#ccc",
                    textIndent: "2em"
                }}>测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试</p>
                <p style={{
                    fontWeight: "bold"
                }}>距离课程开始还有{day}天:{hous}:{mis}:{s}</p>

            </div>
        </div>
    )
}
